<template lang="pug">
  .link-frame.head-page(v-if='data')
    iframe.frame-wrap(width="100%", height="100%", frameborder="0", scrolling="yes", :src="data")
    CtrlBar(:link='data', @closeBar='handleClose()')

</template>

<script>
import CtrlBar from '@/components/CtrlBar'
export default {
  data() {
    return {
      data: null
    }
  },
  mounted() {
    this.$vgo.on('iframe:link', link => {
      // console.log('....123')
      // //判断微信公众号文章ifram无法弹出的情况
      // if(link.indexOf('weixin.qq.com') != -1 || link.indexOf('weixin.com') != -1 || link.indexOf('qq.com') != -1 ||
      //   link.indexOf('fjnx.com') != -1 || link.indexOf($globalconfig.DOMAIN) != -1
      // ){
      //   window.location.href = link
      // }
      this.data = link
      this.$bar.finish()
    })
  },
  components: {
    CtrlBar
  },
  methods: {
    handleClose() {
      this.data = null
      // 重新播放内嵌视频
      $VM.$krp.controlsAllVideoin(true)
    }
  }
}
</script>

<style lang="stylus">
.link-frame
  .ctrl-bar
    position fixed
</style>
